package com.workcell.workdata.xthings.controller;

import com.workcell.workdata.common.core.util.R;
import com.workcell.workdata.common.security.annotation.Inner;
import com.workcell.workdata.xthings.dto.ReturnDataVO;
import com.workcell.workdata.xthings.entity.mqtt.BeltScalesData;
import com.workcell.workdata.xthings.entity.mqtt.FlowMeterData;
import com.workcell.workdata.xthings.entity.mqtt.FreezerData;
import com.workcell.workdata.xthings.entity.mqtt.PowerMeterData;
import com.workcell.workdata.xthings.service.BeltScalesRealDataService;
import com.workcell.workdata.xthings.service.FlowMeterRealDataService;
import com.workcell.workdata.xthings.service.FreezerRealDataService;
import com.workcell.workdata.xthings.service.PowerMeterRealDataService;
import com.workcell.workdata.xthings.service.impl.mqtt.BeltScalesRealDataServiceImpl;
import com.workcell.workdata.xthings.service.impl.mqtt.FlowMeterRealDataServiceImpl;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;

/**
 * @author zhangguangrui
 * @create 2023-06-02 9:33
 */
@RestController
@RequiredArgsConstructor
@RequestMapping("/remotedata")
@Api(value = "remotedata", tags = "推送数据给智能工站管理")
public class ProvideStationDataController {
    private final BeltScalesRealDataService beltScalesDataService;
    private final FlowMeterRealDataService flowMeterDataService;
    private final PowerMeterRealDataService powerMeterDataService;
    private final FreezerRealDataService freezerDataService;


    /**
     * 皮带秤数据
     */
    @ApiOperation(value = "皮带秤数据", notes = "皮带秤数据")
    @Inner(value = false)
    @PostMapping("/returnBeltScalesData")
    public R<BeltScalesData> returnBeltScalesData(@RequestBody ReturnDataVO returnDataVO) {
        return R.ok(beltScalesDataService.returnBeltScalesData(returnDataVO));
    }

    /**
     * 流量计数据
     */
    @ApiOperation(value = "流量计数据", notes = "流量计数据")
    @Inner(value = false)
    @PostMapping("/returnFlowMeterData")
    public R<FlowMeterData> returnFlowMeterData(@RequestBody ReturnDataVO returnDataVO){
        return R.ok(flowMeterDataService.returnFlowMeterData(returnDataVO));
    }

    /**
     * 功率计数据
     */
    @ApiOperation(value = "功率计数据", notes = "功率计数据")
    @Inner(value = false)
    @PostMapping("/returnPowerMeterData")
    public R<PowerMeterData> returnPowerMeterData(@RequestBody ReturnDataVO returnDataVO){
        return R.ok(powerMeterDataService.returnPowerMeterData(returnDataVO));
    }

    /**
     * 冷冻机数据
     */
    @ApiOperation(value = "冷冻机数据", notes = "冷冻机数据")
    @Inner(value = false)
    @PostMapping("/returnFreezerData")
    public R<FreezerData> returnFreezerData(@RequestBody ReturnDataVO returnDataVO){
        return R.ok(freezerDataService.returnPowerMeterData(returnDataVO));
    }


}
